<%@page import="com.estore.manager.InterfaceManager"%>
<%@page import="com.estore.entity.WebInterface"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page language="java" import="java.util.*"%>
<%
    WebApplicationContext context1 = WebApplicationContextUtils.getWebApplicationContext(application);
	InterfaceManager interfaceManager1 = (InterfaceManager) context1.getBean("interface");
	WebInterface webInterface1 = interfaceManager1.getWebInterface();
%>
<% 
	String banner = new String("/common/banner/DefaultBanner.jsp");
	String search = new String("/common/sidebar/SearchField.jsp");
	String categoriesBar = new String("/common/sidebar/sideBar.jsp");
	String footer = new String("/common/footer.jsp");
	if(request.getAttribute("shopModel.shopInterface.banner") != null){
		banner = (String) request.getAttribute("shopModel.shopInterface.banner");
	} 
	if(request.getAttribute("shopModel.shopInterface.searchField") != null){
		search = (String) request.getAttribute("shopModel.shopInterface.searchField");
	}
	if(request.getAttribute("shopModel.shopInterface.categoriesBar") != null){
		categoriesBar = (String) request.getAttribute("shopModel.shopInterface.categoriesBar");
	}
	if(request.getAttribute("shopModel.shopInterface.footer") != null){
		footer = (String) request.getAttribute("shopModel.shopInterface.footer");
	}
%>

<tiles:definition id="homepage-definition" page="/common/template/homepage-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="banner" value="<%= webInterface1.getBanner() %>" />
	<tiles:put name="search" value="/common/sidebar/SearchField.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="webmanagement-definition" page="/common/template/WebInterface-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="sidebar" value="/common/sidebar/WebInterface-sidebar.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="definition2" page="/common/template/template2.jsp">
	<tiles:put name="header" value='/common/header.jsp' />
	<tiles:put name="banner" value='<%= banner %>' />
	<tiles:put name="search" value='<%= search %>' />
	<tiles:put name="sidebar" value='<%= categoriesBar %>' />
	<tiles:put name="footer" value='<%= footer %>'/>
</tiles:definition>
<tiles:definition id="definition1" page="/common/template/template1.jsp">
	<tiles:put name="header" value='/common/header.jsp' />
	<tiles:put name="banner" value='<%= banner %>' />
	<tiles:put name="search" value='<%= search %>' />
	<tiles:put name="sidebar" value='<%= categoriesBar %>' />
	<tiles:put name="footer" value='<%= footer %>'/>
</tiles:definition>
<tiles:definition id="admin-definition" page="/common/template/admin-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="admin-tab" value="/common/sidebar/admin-sidebar.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="detail-product" page="/common/template/detail-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="search" value="/common/sidebar/SearchField.jsp" />
	<tiles:put name="banner" value="/common/banner/DefaultBanner.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="shopdetail-product" page="/common/template/shopdetail-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="search" value='<%= search %>' />
	<tiles:put name="footer" value='<%= footer %>'/>
</tiles:definition>
<tiles:definition id="default-product" page="/common/template/default-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="banner" value="/common/banner/DefaultBanner.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="user-definition" page="/common/template/user-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="sidebar" value="/common/sidebar/user-sidebar.jsp" />
	<tiles:put name="banner" value="/common/banner/DefaultBanner.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="shop-definition" page="/common/template/shop-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="sidebar" value="/common/sidebar/shop-sidebar.jsp" />
	<tiles:put name="banner" value="/common/banner/DefaultBanner.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
<tiles:definition id="shopinterfacemng-definition" page="/common/template/shopinterface-template.jsp">
	<tiles:put name="header" value="/common/header.jsp" />
	<tiles:put name="sidebar" value="/common/sidebar/ShopInterfaceMng-sidebar.jsp" />
	<tiles:put name="banner" value="/common/banner/DefaultBanner.jsp" />
	<tiles:put name="footer" value="/common/footer.jsp" />
</tiles:definition>
